home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / appsrcs.zip / APPTASK.ZIP / SETUP.C < prev    next >
C/C++ Source or Header  |  1993-03-15  |  3KB  |  115 lines

  1. #define STRICT
  2. #include <windows.h>
  3. #include <windowsx.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include "apptask.h"
  8.  
  9. /*-------------------------------------------------------------------------*/
  10. BOOL WINAPI SetupDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  11.     {
  12.     OFSTRUCT    of;
  13.     BOOL bAlreadyTaskMan = FALSE;
  14.  
  15.     switch(message)
  16.     {
  17.     case WM_INITDIALOG:
  18.         GetPrivateProfileString("boot", "taskman.exe", "  ", szBuffer, 255, "system.ini");
  19.         if(strstr(AnsiLower(szBuffer),"apptask.exe"))
  20.         {
  21.         bAlreadyTaskMan = TRUE;
  22.         CheckDlgButton(hDlg, IDS_REPLACE, TRUE);
  23.         }
  24.         else
  25.         bAlreadyTaskMan = FALSE;
  26.         if(ShowAll)
  27.         CheckDlgButton(hDlg, IDS_ALL, TRUE);
  28.         if(CloseDeAct)
  29.         CheckDlgButton(hDlg, IDS_DEACT, TRUE);
  30.         CheckRadioButton(hDlg, IDS_CLOSE, IDS_QUIT, IDS_CLOSE+CloseMode);
  31.         return TRUE;
  32.  
  33.     case WM_COMMAND:
  34.         switch(wParam)
  35.         {
  36.         case IDS_REPLACE:
  37.             CheckDlgButton(hDlg, IDS_REPLACE, !IsDlgButtonChecked(hDlg, IDS_REPLACE));
  38.             return TRUE;
  39.  
  40.         case IDS_ALL:
  41.             CheckDlgButton(hDlg, IDS_ALL, !IsDlgButtonChecked(hDlg, IDS_ALL));
  42.             return TRUE;
  43.  
  44.         case IDS_DEACT:
  45.             CheckDlgButton(hDlg, IDS_DEACT, !IsDlgButtonChecked(hDlg, IDS_DEACT));
  46.             return TRUE;
  47.  
  48.         case IDS_CLOSE:
  49.             CloseMode = 0;
  50.             CheckRadioButton(hDlg, IDS_CLOSE, IDS_QUIT, IDS_CLOSE);
  51.             return TRUE;
  52.  
  53.         case IDS_DESTROY:
  54.             CloseMode = 1;
  55.             CheckRadioButton(hDlg, IDS_CLOSE, IDS_QUIT, IDS_DESTROY);
  56.             return TRUE;
  57.  
  58.         case IDS_QUIT:
  59.             CloseMode = 2;
  60.             CheckRadioButton(hDlg, IDS_CLOSE, IDS_QUIT, IDS_QUIT);
  61.             return TRUE;
  62.  
  63.         case IDS_OK:
  64.             /* save Replace setting */
  65.             if(IsDlgButtonChecked(hDlg, IDS_REPLACE) && !bAlreadyTaskMan)
  66.             {
  67.             if(OpenFile("apptask.exe", &of, OF_EXIST | OF_SEARCH) != -1)
  68.                 {
  69.                 strcpy(szBuffer, of.szPathName);
  70.                 }
  71.             else
  72.                 {
  73.                 strcpy(szBuffer, "apptask.exe");
  74.                 }
  75.             WritePrivateProfileString("boot", "taskman.exe", szBuffer, "system.ini");
  76.             }
  77.             if(!IsDlgButtonChecked(hDlg, IDS_REPLACE) && bAlreadyTaskMan)
  78.             WritePrivateProfileString("boot", "taskman.exe", "taskman.exe", "system.ini");
  79.  
  80.             /* save ShowAll setting */
  81.             if(IsDlgButtonChecked(hDlg, IDS_ALL))
  82.             ShowAll = 1;
  83.             else
  84.             ShowAll = 0;
  85.             sprintf(szBuffer, "%d", ShowAll);
  86.             WritePrivateProfileString("AppTask", "ShowAll", szBuffer, "AppTools.ini");
  87.  
  88.             /* save Close Deactivated setting */
  89.             if(IsDlgButtonChecked(hDlg, IDS_DEACT))
  90.             CloseDeAct = 1;
  91.             else
  92.             CloseDeAct = 0;
  93.             sprintf(szBuffer, "%d", CloseDeAct);
  94.             WritePrivateProfileString("AppTask", "CloseDeAct", szBuffer, "AppTools.ini");
  95.  
  96.             /* save CloseMode setting */
  97.             sprintf(szBuffer, "%d", CloseMode);
  98.             WritePrivateProfileString("AppTask", "CloseMode", szBuffer, "AppTools.ini");
  99.  
  100.             EndDialog(hDlg, 0);
  101.             return TRUE;
  102.  
  103.         case IDS_HELP:
  104.             WinHelp(hWndAppTask, "AppTools.hlp", HELP_CONTENTS, 0L);
  105.             return TRUE;
  106.  
  107.         case IDS_CANCEL:
  108.             EndDialog(hDlg, 0);
  109.             return TRUE;
  110.         }
  111.         break;
  112.     }
  113.     return FALSE;
  114.     }
  115.